


Calls
Calls are the fundamental building block in Weave. They represent a single execution of a function, including:
- Inputs (arguments)
- Outputs (return value)
- Metadata (duration, exceptions, LLM usage, etc.)
- Belong to a Trace (a collection of calls in the same execution context)
- Have parent and child Calls, forming a tree structure
Creating Calls
There are three main ways to create Calls in Weave:1. Automatic tracking of LLM libraries
Weave automatically tracks calls to common LLM libraries like
openai
, anthropic
, cohere
, and mistral
. Simply call weave.init('project_name')
at the start of your program:You can control Weave’s default tracking behavior using the
autopatch_settings
argument in weave.init
.showLineNumbers
Summary
You can store metrics or other post-call values in thesummary
dictionary of a Call. Modify call.summary
during execution and any
values you add will be merged with Weave’s computed summary data when
the call finishes.
2. Decorating and wrapping functions
However, often LLM applications have additional logic (such as pre/post processing, prompts, etc.) that you want to track.Weave allows you to manually track these calls using the You can also track methods on classes.
@weave.op
decorator. For example:showLineNumbers
Trace sync & async generator functions
Weave supports tracing both sync and async generator functions, including deeply nested patterns.Since generators yield values lazily, the outputs are only logged when the generator is fully consumed (e.g., by converting it to a list).
To ensure outputs are captured in the trace, fully consume the generator (e.g., by using
list()
).showLineNumbers

Getting a handle to the call object during execution
Sometimes it is useful to get a handle to the Then,
Call
object itself. You can do this by calling the op.call
method, which returns both the result and the Call
object. For example:showLineNumbers
call
can be used to set / update / fetch additional properties (most commonly used to get the ID of the call to be used for feedback).If your op is a method on a class, you need to pass the instance as the first argument to the op (see example below).
showLineNumbers
showLineNumbers
Call display name
Sometimes you may want to override the display name of a call. You can achieve this in one of four ways:
- Change the display name at the time of calling the op:
showLineNumbers
Using the
__weave
dictionary sets the call display name which will take precedence over the Op display name.- Change the display name on a per-call basis. This uses the
Op.call
method to return aCall
object, which you can then use to set the display name usingCall.set_display_name
.
showLineNumbers
- Change the display name for all Calls of a given Op:
showLineNumbers
-
The
call_display_name
can also be a function that takes in aCall
object and returns a string. TheCall
object will be passed automatically when the function is called, so you can use it to dynamically generate names based on the function’s name, call inputs, fields, etc. -
One common use case is just appending a timestamp to the function’s name.
-
You can also log custom metadata using
.attributes
@weave.op
.
By default, the Op’s name is the function name, and the associated calls will have the same display name. The above example shows how to override the display name for all Calls of a given Op. Sometimes, users wish to override the name of the Op itself. This can be achieved in one of two ways:- Set the
name
property of the Op before any calls are logged
showLineNumbers
- Set the
name
option on the op decorator
showLineNumbers
Attributes
When calling tracked functions, you can add additional metadata to the call by using
weave.attributes
context manager. In the example below, we add an env
attribute to the call specified as 'production'
.showLineNumbers
call.attributes
cannot be modified once the call starts. Use this
context manager to set any metadata before invoking the op.Trace parallel (multi-threaded) function calls
By default, parallel calls all show up in Weave as separate root calls. To get correct nesting under the same parent In the Weave UI, this produces a single parent call with five nested child calls, so that you get a fully hierarchical trace even though the increments run in parallel.
op
, use ThreadPoolExecutor
.The following code sample demonstrates the use of ThreadPoolExecutor
.
The first function, func
, is a simple op
that takes x
and returns x+1
. The second function, outer
, is another op
that accepts a list of inputs.
Inside outer
, the use of ThreadPoolExecutor
and exc.map(func, inputs)
means that each call to func
still carries the same parent trace context.
3. Manual Call tracking
You can also manually create Calls using the API directly.showLineNumbers
4. Track class and object methods
You can also track class and object methods.Track any method on a class using
weave.op
.showLineNumbers
Viewing Calls
To view a call in the web app:
- Navigate to your project’s “Traces” tab
- Find the call you want to view in the list
- Click on the call to open its details page

Updating Calls
Calls are mostly immutable once created, however, there are a few mutations which are supported: All of these mutations can be performed from the UI by navigating to the call detail page:
Set display name
In order to set the display name of a call, you can use the
Call.set_display_name
method.showLineNumbers
Add feedback
Please see the Feedback Documentation for more details.Delete a Call
To delete a Call using the Python API, you can use the
Call.delete
method.showLineNumbers
Delete multiple Calls
To delete batches of Calls using the Python API, pass a list of Call IDs to
delete_calls()
.showLineNumbers
Querying and exporting Calls

/calls
page of your project (“Traces” tab) contains a table view of all the Calls in your project. From there, you can:
- Sort
- Filter
- Export

To fetch calls using the Python API, you can use the
client.get_calls
method:Call schema
Please see the schema for a complete list of fields.Property | Type | Description |
---|---|---|
id | string (uuid) | Unique identifier for the call |
project_id | string (optional) | Associated project identifier |
op_name | string | Name of the operation (can be a reference) |
display_name | string (optional) | User-friendly name for the call |
trace_id | string (uuid) | Identifier for the trace this call belongs to |
parent_id | string (uuid) | Identifier of the parent call |
started_at | datetime | Timestamp when the call started |
attributes | Dict[str, Any] | User-defined metadata about the call (read-only during execution) |
inputs | Dict[str, Any] | Input parameters for the call |
ended_at | datetime (optional) | Timestamp when the call ended |
exception | string (optional) | Error message if the call failed |
output | Any (optional) | Result of the call |
summary | Optional[SummaryMap] | Post-execution summary information. You can modify this during execution to record custom metrics. |
wb_user_id | Optional[str] | Associated Weights & Biases user ID |
wb_run_id | Optional[str] | Associated Weights & Biases run ID |
deleted_at | datetime (optional) | Timestamp of call deletion, if applicable |
- The
id
,trace_id
, andparent_id
fields help in organizing and relating calls within the system. - Timing information (
started_at
,ended_at
) allows for performance analysis. - The
attributes
andinputs
fields provide context for the call. Attributes are frozen once the call starts, so set them before invocation withweave.attributes
.output
andsummary
capture the results, and you can updatesummary
during execution to log additional metrics. - Integration with Weights & Biases is facilitated through
wb_user_id
andwb_run_id
.
- Cost
- Duration
- Status
Saved views
You can save your Trace table configurations, filters, and sorts as saved views for quick access to your preferred setup. You can configure and access saved views via the UI and the Python SDK. For more information, see Saved Views.View a W&B run in the Traces table
With Weave, you can trace function calls in your code and link them directly to the W&B runs in which they were executed. When you trace a function with @weave.op() and call it inside a wandb.init() context, Weave automatically associates the trace with the W&B run. Links to any associated runs are shown in the Traces table.Python example
The following Python code shows how traced operations are linked to W&B runs when executed inside awandb.init()
context. These traces appear in the
Weave UI and are associated with the corresponding run.
-
In the terminal, install dependencies:
-
Log in to W&B:
-
In the script, replace
your-username/your-project
with your actual W&B entity/project. -
Run the script:
- Visit https://weave.wandb.ai and select your project.
- In the Traces tab, view the trace output. Links to any associated runs are shown in the Traces table.
Configure autopatching
By default, Weave automatically patches and tracks calls to common LLM libraries likeopenai
, anthropic
, cohere
, and mistral
.
You can control this behavior using the autopatch_settings
argument in weave.init
.
Disable all autopatching
showLineNumbers
Disable a specific integration
showLineNumbers
Post-process inputs and outputs
You can also customize how post-process inputs and outputs (e.g. for PII data) are handled during autopatching:showLineNumbers
FAQs
How do I stop large traces from being truncated?
For more information, see Trace data is truncated in the Troubleshooting guide.How do I disable tracing?
Environment variable
In situations where you want to unconditionally disable tracing for the entire program, you can set the environment variableWEAVE_DISABLED=true
.
Client initialization
Sometimes, you may want to conditionally enable tracing for a specific initialization based on some condition. In this case, you can initialize the client with thedisabled
flag in init settings.
Context manager
Finally, you may want to conditionally disable tracing for a single function based on some application logic. In this case, you can use the context managerwith set_tracing_enabled(False)
which can be imported from weave.trace.context.call_context
.
How do I capture information about a Call?
Typically you would call an op directly:call
method on the op:
call
object will have all the information about the call, including the inputs, outputs, and other metadata.